package com.max.constants;

import com.max.exceptions.EnumNotFoundException;

public enum RoleType {

    ROLE_ADMIN("管理员"),

    ROLE_USER("普通用户"),

    ROLE_MANAGE("经理");

    private final String roleName;

    RoleType(String roleName){
        this.roleName = roleName;
    }

    public static RoleType getRoleTypeByCode(String roleCode){
        for (RoleType value : values()) {
            if(value.name().equals(roleCode)){
                return value;
            }
        }
        throw EnumNotFoundException.ENUM_NOT_FOUND_EXCEPTION;
    }


    public String getRoleName() {
        return roleName;
    }

}
